package com.tianxin.workbao.workBao.bean;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.util.Log;

import org.greenrobot.greendao.AbstractDaoMaster;
import org.greenrobot.greendao.database.StandardDatabase;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.database.DatabaseOpenHelper;
import org.greenrobot.greendao.identityscope.IdentityScopeType;


// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
/**
 * Master of DAO (schema version 2): knows all DAOs.
 */
public class DaoMaster extends AbstractDaoMaster {
    public static final int SCHEMA_VERSION = 2;

    /** Creates underlying database table using DAOs. */
    public static void createAllTables(Database db, boolean ifNotExists) {
        AddressDao.createTable(db, ifNotExists);
        BaseStatisticDao.createTable(db, ifNotExists);
        CarFinanceDao.createTable(db, ifNotExists);
        CarFinanceStatisticDao.createTable(db, ifNotExists);
        CarInformationDao.createTable(db, ifNotExists);
        CarmoneyDao.createTable(db, ifNotExists);
        ChartDao.createTable(db, ifNotExists);
        CoalDao.createTable(db, ifNotExists);
        CoalFactoryDao.createTable(db, ifNotExists);
        CoalMoneyCalcDao.createTable(db, ifNotExists);
        ContractDao.createTable(db, ifNotExists);
        ContractStatisticDao.createTable(db, ifNotExists);
        CtCoaltypeDao.createTable(db, ifNotExists);
        CustomersDao.createTable(db, ifNotExists);
        FueldiaryDao.createTable(db, ifNotExists);
        InputbillDao.createTable(db, ifNotExists);
        LineUpDao.createTable(db, ifNotExists);
        LoaderDao.createTable(db, ifNotExists);
        LoaderUseDao.createTable(db, ifNotExists);
        MobileChartDao.createTable(db, ifNotExists);
        MoneyflowDao.createTable(db, ifNotExists);
        OilPriceDao.createTable(db, ifNotExists);
        OrganizationDao.createTable(db, ifNotExists);
        OutputBillDao.createTable(db, ifNotExists);
        PreSettlementDao.createTable(db, ifNotExists);
        RoleDao.createTable(db, ifNotExists);
        SamplingDao.createTable(db, ifNotExists);
        StorageDao.createTable(db, ifNotExists);
        StorageStatisticDao.createTable(db, ifNotExists);
        TestItemDao.createTable(db, ifNotExists);
        TestbillDao.createTable(db, ifNotExists);
        TotalstaticDao.createTable(db, ifNotExists);
        TransContractDao.createTable(db, ifNotExists);
        TransMoneyCalcDao.createTable(db, ifNotExists);
        TransPriceDao.createTable(db, ifNotExists);
        TransfermoneyDao.createTable(db, ifNotExists);
        UserDao.createTable(db, ifNotExists);
        UserroleKeyDao.createTable(db, ifNotExists);
        WaitStatisticDao.createTable(db, ifNotExists);
        WashCoaltypeDao.createTable(db, ifNotExists);
        WashReportDao.createTable(db, ifNotExists);
        WashWorkDao.createTable(db, ifNotExists);
    }

    /** Drops underlying database table using DAOs. */
    public static void dropAllTables(Database db, boolean ifExists) {
        AddressDao.dropTable(db, ifExists);
        BaseStatisticDao.dropTable(db, ifExists);
        CarFinanceDao.dropTable(db, ifExists);
        CarFinanceStatisticDao.dropTable(db, ifExists);
        CarInformationDao.dropTable(db, ifExists);
        CarmoneyDao.dropTable(db, ifExists);
        ChartDao.dropTable(db, ifExists);
        CoalDao.dropTable(db, ifExists);
        CoalFactoryDao.dropTable(db, ifExists);
        CoalMoneyCalcDao.dropTable(db, ifExists);
        ContractDao.dropTable(db, ifExists);
        ContractStatisticDao.dropTable(db, ifExists);
        CtCoaltypeDao.dropTable(db, ifExists);
        CustomersDao.dropTable(db, ifExists);
        FueldiaryDao.dropTable(db, ifExists);
        InputbillDao.dropTable(db, ifExists);
        LineUpDao.dropTable(db, ifExists);
        LoaderDao.dropTable(db, ifExists);
        LoaderUseDao.dropTable(db, ifExists);
        MobileChartDao.dropTable(db, ifExists);
        MoneyflowDao.dropTable(db, ifExists);
        OilPriceDao.dropTable(db, ifExists);
        OrganizationDao.dropTable(db, ifExists);
        OutputBillDao.dropTable(db, ifExists);
        PreSettlementDao.dropTable(db, ifExists);
        RoleDao.dropTable(db, ifExists);
        SamplingDao.dropTable(db, ifExists);
        StorageDao.dropTable(db, ifExists);
        StorageStatisticDao.dropTable(db, ifExists);
        TestItemDao.dropTable(db, ifExists);
        TestbillDao.dropTable(db, ifExists);
        TotalstaticDao.dropTable(db, ifExists);
        TransContractDao.dropTable(db, ifExists);
        TransMoneyCalcDao.dropTable(db, ifExists);
        TransPriceDao.dropTable(db, ifExists);
        TransfermoneyDao.dropTable(db, ifExists);
        UserDao.dropTable(db, ifExists);
        UserroleKeyDao.dropTable(db, ifExists);
        WaitStatisticDao.dropTable(db, ifExists);
        WashCoaltypeDao.dropTable(db, ifExists);
        WashReportDao.dropTable(db, ifExists);
        WashWorkDao.dropTable(db, ifExists);
    }

    /**
     * WARNING: Drops all table on Upgrade! Use only during development.
     * Convenience method using a {@link DevOpenHelper}.
     */
    public static DaoSession newDevSession(Context context, String name) {
        Database db = new DevOpenHelper(context, name).getWritableDb();
        DaoMaster daoMaster = new DaoMaster(db);
        return daoMaster.newSession();
    }

    public DaoMaster(SQLiteDatabase db) {
        this(new StandardDatabase(db));
    }

    public DaoMaster(Database db) {
        super(db, SCHEMA_VERSION);
        registerDaoClass(AddressDao.class);
        registerDaoClass(BaseStatisticDao.class);
        registerDaoClass(CarFinanceDao.class);
        registerDaoClass(CarFinanceStatisticDao.class);
        registerDaoClass(CarInformationDao.class);
        registerDaoClass(CarmoneyDao.class);
        registerDaoClass(ChartDao.class);
        registerDaoClass(CoalDao.class);
        registerDaoClass(CoalFactoryDao.class);
        registerDaoClass(CoalMoneyCalcDao.class);
        registerDaoClass(ContractDao.class);
        registerDaoClass(ContractStatisticDao.class);
        registerDaoClass(CtCoaltypeDao.class);
        registerDaoClass(CustomersDao.class);
        registerDaoClass(FueldiaryDao.class);
        registerDaoClass(InputbillDao.class);
        registerDaoClass(LineUpDao.class);
        registerDaoClass(LoaderDao.class);
        registerDaoClass(LoaderUseDao.class);
        registerDaoClass(MobileChartDao.class);
        registerDaoClass(MoneyflowDao.class);
        registerDaoClass(OilPriceDao.class);
        registerDaoClass(OrganizationDao.class);
        registerDaoClass(OutputBillDao.class);
        registerDaoClass(PreSettlementDao.class);
        registerDaoClass(RoleDao.class);
        registerDaoClass(SamplingDao.class);
        registerDaoClass(StorageDao.class);
        registerDaoClass(StorageStatisticDao.class);
        registerDaoClass(TestItemDao.class);
        registerDaoClass(TestbillDao.class);
        registerDaoClass(TotalstaticDao.class);
        registerDaoClass(TransContractDao.class);
        registerDaoClass(TransMoneyCalcDao.class);
        registerDaoClass(TransPriceDao.class);
        registerDaoClass(TransfermoneyDao.class);
        registerDaoClass(UserDao.class);
        registerDaoClass(UserroleKeyDao.class);
        registerDaoClass(WaitStatisticDao.class);
        registerDaoClass(WashCoaltypeDao.class);
        registerDaoClass(WashReportDao.class);
        registerDaoClass(WashWorkDao.class);
    }

    public DaoSession newSession() {
        return new DaoSession(db, IdentityScopeType.Session, daoConfigMap);
    }

    public DaoSession newSession(IdentityScopeType type) {
        return new DaoSession(db, type, daoConfigMap);
    }

    /**
     * Calls {@link #createAllTables(Database, boolean)} in {@link #onCreate(Database)} -
     */
    public static abstract class OpenHelper extends DatabaseOpenHelper {
        public OpenHelper(Context context, String name) {
            super(context, name, SCHEMA_VERSION);
        }

        public OpenHelper(Context context, String name, CursorFactory factory) {
            super(context, name, factory, SCHEMA_VERSION);
        }

        @Override
        public void onCreate(Database db) {
            Log.i("greenDAO", "Creating tables for schema version " + SCHEMA_VERSION);
            createAllTables(db, false);
        }
    }

    /** WARNING: Drops all table on Upgrade! Use only during development. */
    public static class DevOpenHelper extends OpenHelper {
        public DevOpenHelper(Context context, String name) {
            super(context, name);
        }

        public DevOpenHelper(Context context, String name, CursorFactory factory) {
            super(context, name, factory);
        }

        @Override
        public void onUpgrade(Database db, int oldVersion, int newVersion) {
            Log.i("greenDAO", "Upgrading schema from version " + oldVersion + " to " + newVersion + " by dropping all tables");
            dropAllTables(db, true);
            onCreate(db);
        }
    }

}
